package com.pro.common.api.user.file.model.db;

import com.baomidou.mybatisplus.annotation.TableField;
import com.pro.common.api.CommonConst;
import com.pro.common.api.model.BaseUserIdModel;
import com.pro.common.api.model.auth.IUserRecordClass;
import com.pro.common.api.user.file.enums.EnumUploadStatus;
import com.pro.framework.javatodb.annotation.JTDField;
import com.pro.framework.javatodb.annotation.JTDTable;
import com.pro.framework.javatodb.constant.JTDConst;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.lang.NonNull;

@Data
@Schema(description = "用户上传记录")
@JTDTable(module = CommonConst.Modules.userFile, sequences = {
        "KEY `idx_userId_bizType_bizId` (`user_id`,`biz_type`,`biz_id`,`origin_url`)",
//        "KEY `idx_createTime` (`create_time`)",
//        "KEY `idx_status` (`status`)",
//        "KEY `idx_bucket` (`bucket`)"
})
public class UserUploadRecord extends BaseUserIdModel implements IUserRecordClass {

    @Schema(description = "存储桶名")
    @JTDField(mainLength = 64)
    private String bucket;

    /**
     *  {@link EnumUploadBizType}
     */
    @Schema(description = "业务类型 PlusCollectGoodsItem: 采集过程")
    @JTDField(mainLength = 64)
    private String bizType;

    @Schema(description = "biz_type 对应的id 方便查询数据")
    private Long bizId;

    @Schema(description = "原始链接")
    @JTDField(mainLength = 700)
    private String originUrl;

    @Schema(description = "结果链接")
    @JTDField(mainLength = 700)
    private String resultUrl;

    @Schema(description = "内容格式")
    private String contentType;

    @Schema(description = "0: 初始化 1:成功 2:失败")
    @JTDField(type = JTDConst.EnumFieldType.int_, defaultValue = "0", entityClassKey = "value")
    private EnumUploadStatus status;

    @Schema(description = "上传url")
    @TableField(exist = false)
    private String uploadUrl;

}
